<?php

namespace App\AdminModule\Presenters;


use \Grido, 
    \Grido\Grid;
/**
 * User presenter.
 */
class UserPresenter extends BasePresenter {
 
  /** @var \App\Model\UserManager @inject */
  public $um;
  
  /**
   * User grid
   * @param String $name
   * @return \Grido\Grid
   */
  public function createComponentUserGrid($name){
    $g = new Grid($this, $name);
    
    $model = $this->um->getBasicUserListArray();     

    // Grido data
    $g->model = $model;
    
    $g->addColumnText('login', 'Jméno')
        ->setSortable()
        ->setFilterText();
    $g->addColumnText('email', 'Email')
        ->setSortable()
        ->setFilterText();
    $g->addColumnText('statename', 'Stav')
        ->setSortable()
        ->setFilterText();
    $g->addColumnText('rolename', 'Role')
        ->setSortable()
        ->setFilterText();    
    
    // Return grido
    $g->filterRenderType = Grido\Components\Filters\Filter::RENDER_INNER;
    $g->setExport();
    return $g;
  }
}
